home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / cmln0286.arc / DEBUG3.LTG < prev    next >
Text File  |  1986-02-03  |  2KB  |  57 lines

  1.  
  2.                             Listing 3
  3.  
  4.   1: /*------------------------------DRIVER.C-----------------------------------
  5.   2: *  DRIVER.C  Routines to illustrate the use of the symbolic debugger.
  6.   3: *
  7.   4: *
  8.   5: *------------------------------------------------------------------------*/
  9.   6: #include <stdio.h>
  10.   7: #include <debug.h>
  11.   8: /*-----------------------------------------------------------------------*/
  12.   9: func2()       /* this illustrates a typical application of the debugger: */
  13.  10: {             /* 1. record the entry into a function */
  14.  11:               /* 2. record the program variables as they change */
  15.  12:               /* 3. record the exit from the function */
  16.  13:   int small_number;
  17.  14:   long big_number;
  18.  15:   TS("enter func2","-------------------");
  19.  16:   for (small_number = 0, big_number = 0L; small_number < 5; small_number++)
  20.  17:       {
  21.  18:          big_number += small_number *10;
  22.  19:          TI("small_number:",small_number);
  23.  20:          TL("big_number:", big_number);
  24.  21:       }
  25.  22:   TS("exit func2","^^^^^^^^^^^^^^^^^^^");
  26.  
  27.  23: } /*func2*/
  28.  24: /*-----------------------------------------------------------------------*/
  29.  25: func1()            /*illustrate the use of all of the types of traces*/
  30.  26: {
  31.  27:   char a = 'A';
  32.  28:   int j = 123;
  33.  29:   int *j_ptr = &j;è 30:   long k = 456789;
  34.  31:   float f = 12.978;
  35.  32:   static char string[] = "hello, world";
  36.  33:   TS("enter func1","-------------------");
  37.  34:   TC("Character test",a);
  38.  35:   TI("Integer test",j);
  39.  36:   TL("Long test",k);
  40.  37:   TU("Unsigned test",j_ptr);
  41.  38:   TF("Float test",f);
  42.  39:   TD("Double test",123456.789012);
  43.  40:   TS("String test",string);
  44.  41:   TS("exit func1","^^^^^^^^^^^^^^^^^^^^");
  45.  42: } /*func1*/
  46.  43: /*-----------------------------------------------------------------------*/
  47.  44: main()
  48.  45: {
  49.  46:   printf("Debug driver version 02 start\n");
  50.  47:   printf("Press F10 to start trace\n");
  51.  48:   inkey();
  52.  49:   func1();
  53.  50:   func2();
  54.  51:   printf("Debug driver end\n");
  55.  52: } /*main*/
  56.  53: /*--------------------------END DRIVER.C---------------------------------*/
  57.